import { app } from '../application';
import { ccclass } from '../decorators';
import { BaseUI } from './BaseUI';

/**
 * - 作者: DoooReyn
 * - 日期: 2023.10.31
 * - 类名: BaseWindow
 * - 描述: 二级界面基类
 */
@ccclass()
export class BaseWindow extends BaseUI {
    /** 二级窗口被关闭时，需要同步关闭所有弹窗 */
    public async close() {
        if (this._closed) return;

        this._closed = true;
        await app.view.popup.removeAll();
        await app.view.window.remove(this);
        this._closed = false;
    }
}
